-
Notifications
You must be signed in to change notification settings - Fork 75
Join docs #1437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Join docs #1437
Conversation
While this looks much better already, I wonder if there's something we can do with colors, like we have for joinWith: https://kotlin.github.io/dataframe/joinwith.html I think these could help a lot with the visualization of which values end up where. For instance, imagine a yellow dataframe and a light blue one being joined, and the resulting dataframe consisting of the yellow columns, the blue ones and green for the join column(s). We could probably even use the |
|
||
<!---IMPORT org.jetbrains.kotlinx.dataframe.samples.api.multiple.JoinSamples--> | ||
|
||
Joins two [`DataFrame`](DataFrame.md) object by join columns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah you just copied this part from the original file
} | ||
|
||
private fun nameAndCityToColor(name: String, city: String?): RgbColor = when(name to city) { | ||
"Alice" to "London" ->RgbColor(242, 210, 189) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linting
|
||
<inline-frame src="./resources/notebook_test_join_6.html" width="100%" height="500px"></inline-frame> | ||
|
||
If mapped columns have the same name, just select join columns from the left [`DataFrame`](DataFrame.md): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm it's hard to see where the previous example ends and the new one begins. Maybe you could give them a small title?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you do exactly that below :) nice
The colors help a lot! Thanks :) |
|
||
### Join with implicit keys (all columns with the same name) {collapsible="true"} | ||
|
||
If `joinColumns` is not specified, columns with the same name from both [`DataFrame`](DataFrame.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You say joinColumns
is not specified, yet in the example, you show { name and city }
```kotlin | ||
// LEFT JOIN: | ||
// Keep ALL left rows. If (name, city) matches, attach right columns; | ||
// if not, right columns are null (e.g., Alice–London has no right match). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*columns from the right dataframe
Also, Alice-London does have a match, Bob-Dubai does not, so isBusy == null
```kotlin | ||
// INNER JOIN: | ||
// Keep only rows where (name, city) match on both sides. | ||
// In this dataset both Charlies match twice (Moscow, Milan) → 2 merged rows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean "both charlies"?, the result shows Alice
and Charlie
```kotlin | ||
// FULL JOIN: | ||
// Keep ALL rows from both sides. Where there's no match on (name, city), | ||
// the other side is filled with nulls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you make all nulls
bold? so it's clearer these are new, added to fill in the gaps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.format().with { if (it == null) bold else null }
will do
I still find the examples hard to follow, I'm wondering how we can make it as clear as possible :)
Closes #583